﻿namespace LocalOverride.Fiddler
{
    public class ErrorNotification
    {
        public string Field { get; private set; }
        public string Message { get; private set; }

        public ErrorNotification(string field, string message)
        {
            Field = field;
            Message = message;
        }

        public bool Equals(ErrorNotification other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.Field, Field) && Equals(other.Message, Message);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (ErrorNotification)) return false;
            return Equals((ErrorNotification) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((Field != null ? Field.GetHashCode() : 0)*397) ^ (Message != null ? Message.GetHashCode() : 0);
            }
        }
    }
}